make_lateral_view

#set base_dir [file join /vols Data daa lhunt MEG spm_data source_space_beamforming_images all_subs_resp_locked_bl_maineffect surface_frames]
set base_dir [file join [pwd] surface_frames]
set tmp  [lsort [glob [file join $base_dir TS*-${hemi}.w]]]
foreach file_name $tmp {

    puts ${file_name}
    set gaLinkedVars(colscalebarflag) 0
    SendLinkedVarGroup view

    set val $file_name
    sclv_read_from_dotw 0
    make_lateral_view
    redraw
    set blah1 ${file_name}_lateral.tiff
    save_tiff ${blah1}

    if { [string match $hemi rh] == 1 } {
	exec convert ${blah1} -font Helvetica -pointsize 24 -stroke none -fill white -gravity SouthEast -annotate +10+10 R ${blah1}
    }	else {
	exec convert ${blah1} -font Helvetica -pointsize 24 -stroke none -fill white -gravity SouthWest -annotate +10+10 L ${blah1}
    }

    if { [string match $hemi rh] == 1 } {
	rotate_brain_y -90
	rotate_brain_x -90
	set gaLinkedVars(colscalebarflag) 1
	SendLinkedVarGroup view
    } else {
	rotate_brain_y 90
	rotate_brain_x -90
    }
    redraw

    set blah2 ${file_name}_topdown.tiff
    save_tiff ${blah2}

    set gaLinkedVars(colscalebarflag) 0
    SendLinkedVarGroup view
    redraw
    if { [string match $hemi rh] == 1 } {
	set cbar  ${file_name}_cbar.tiff
    
	exec convert ${blah2} -crop 100x200+500+400 ${cbar}
	exec convert ${blah2} -fill black -stroke black -draw "rectangle 500,0 600,600" ${blah2}
	exec convert ${cbar} -resize 200x400 ${cbar}
	exec composite -gravity East ${cbar} ${blah2} ${blah2}
	exec rm ${cbar}
	rotate_brain_x 90
	rotate_brain_y -90
	set gaLinkedVars(colscalebarflag) 0
	SendLinkedVarGroup view
    } else {
	rotate_brain_x 90
	rotate_brain_y 90
    }


    redraw
    set blah3 ${file_name}_medial.tiff
    save_tiff ${blah3}


    #puts "HERE"

    exec montage $blah1 $blah3 $blah2 -tile x3 -geometry 400x400>+0+0 ${file_name}_all.tiff
    exec rm $blah1 $blah2 $blah3
}

exit